<template>
	<div>
		<a-radio-group :default-value="null" button-style="solid" v-model="stateValue"
		@change="$emit('change', $event.target.value)">
		<a-radio-button :value="null">
			全部
		</a-radio-button>
		<a-radio-button @change="change" :value="id" v-for="{ id, name } in sysOrgs">
			{{ name }}
		</a-radio-button>
		
	</a-radio-group>
	<div v-show="false">
			{{ filteredOrgList }}
		</div>
	</div>
</template>
<script>
import { sysList as emsOrgList } from '@/api/modular/main/emsorg/emsOrgManage'

export default {
	name: 'FCOrgRadioGroup',
	model: {
		prop: 'orgId',
		event: 'change'
	},
	props: {
		orgId: 0,
		filterTypes: {
			type: String,
			default: () => ""
		},
	},
	data() {
		return {
			stateValue: null,
			sysOrgs: []
		}
	},
	computed: {
		filteredOrgList() {			
			console.log(1231231);
			
			this.getOrgList(this.filterTypes);			
		},
	},
	watch: {
		orgId(newValue) {
			this.stateValue = newValue
		}
	},
	methods: {
		change() {
			this.$emit('change')
		},
		 getOrgList(filterTypes) {
			debugger
			emsOrgList({
				materialType: filterTypes,
				isSupplier: 1
			}).then(res=>{
				this.sysOrgs = res.data.rows;
			})
			// return result.data
		}
	},
	created() {
		// this.getOrgList()
	}
}
</script>
<style lang="less">
button {
	margin-right: 8px;
}
</style>